import dayjs from 'dayjs';
const setupFormat=(app)=>{
    app.directive('format', {
        mounted: (el, binding) => {
            try {
                const formattedDate = dayjs(binding.value).format("YYYY-MM-DD HH:mm:ss");
                el.textContent = formattedDate;
            } catch (error) {
                console.error('Invalid date format:', binding.value);
                el.textContent = 'Invalid date';
            }
        },
        updated: (el, binding) => {
            try {
                const formattedDate = dayjs(binding.value).format("YYYY-MM-DD HH:mm:ss");
                el.textContent = formattedDate;
            } catch (error) {
                console.error('Invalid date format:', binding.value);
                el.textContent = 'Invalid date';
            }
        }
    });
}
export {setupFormat}